<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>

<html lang="en">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=11">
        <link rel="stylesheet" href="<%=basePath %>client/css/cssreset.css">
        <link rel="stylesheet" href="<%=basePath %>client/css/style.css">
        <link rel="stylesheet" href="<%=basePath %>client/css/style2.css">
        <link rel="stylesheet" href="<%=basePath%>css/mycss.css"> 
        <link rel="stylesheet" href="<%=basePath%>css/mystyle.css">
        <script src="<%=basePath %>client/js/jquery-1.11.1.min.js"></script>
        
        <style type="text/css">
        	
		   	#pageaaa a{
			        width: 23px;
			        height: 23px;
			        border: 1px solid #dce0e0;
			        text-align: center;
			        margin: 0 4px;
			        cursor: pointer;
			        display: inline-block;
			        font-size: 17px;
			    }
			    .current{
			        background-color: #5ac3e7;
			    }
			    
        	.bianjis{
				width: 552px;
				height: 369px;
				border:1px solid #ccc;
				border-radius:5px;
				position:absolute;
				top:110px;
				left:50%;
				margin-left:-260px;
				background:#fff;
				display:none;
				z-index:1;
			}
			.bianjis>p{
				width:100%;
				line-height:42px;
				text-indent:2em;
				color:#818181;
				border-bottom:1px solid #dddddd;
			}
			.bianjis>p>img{
				cursor:pointer;
				position:relative;
				left:426px;
			}
			.bianjis>form>p{
				text-align:center;
				margin-bottom:21px;
				color:#555555;
				overflow:hidden;
			}
			.bianjis>form>p>span:nth-of-type(2){
				color:red;
				margin-left:10px;
			}
			
			.bianjis>form>p:nth-of-type(1){
				margin-top:19px;
				
			}
			.bianjis>form>p>input{
				float:none;
				width:300px;
				height:28px;
				text-align:left;
				margin-left:50px;
				outline:none;
				border:1px solid #ccc;
				border-radius:5px;
			}
			
			.bianjis>form>p:nth-of-type(7){
				width:100%;
				height:32px;
				background:#dfe4ea;
				padding:10px 0;
			}
			.bianjis>form>p:nth-of-type(7)>input{
				width: 56px;
				line-height: 28px;
				background:#57c049;
				border:none;
				border-radius:5px;
				color:#fff;
				position:relative;
				left:160px;
				cursor:pointer;
				text-align:center;
			}
			.bianjis>form>p:nth-of-type(7)>input:nth-of-type(1){
				left:190px;
				background:#ccc;
			}
			.smallsa{
				width:100%;
				height:1062px;
				position:absolute;
				top:0px;
				left:0px;
				background:rgba(0,0,0,0.2);
				display:none;
			}
			.smallsa1{
				width:100%;
				height:1148px;
				position:absolute;
				top:0px;
				left:0px;
				background:rgba(0,0,0,0.2);
				display:none;
			}
			.yezi1 .bianji1{
			position: absolute;
			left: 35%;
			display: none;
			bottom:22px;
			}
			.tline>td{
				text-align:center;
			}
			
			
			
			ol li{
				float:left;
				padding:5px 10px;
				background:#2f4050;
				margin-right:5px;
			}
			ol li>a{
				text-decoration:none;
				color:#929da8;
				font-size:14px;
			}
			.aaa{
				padding-left:13px;
			}
		  </style>
         <script>
        	
            $(function(){
            	$(".light3").click(function(e){
			    	
			        e.preventDefault();
			        $("#cover4").css("display","block");
			        $("#cover4").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        
			    });
			    $(".close").click(function(){
			        $("#cover4").removeAttr("style");
			        $("#cover-content3").removeAttr("style");
			    });
                $('.sh1').mouseover(function(event) {
                    $('.showhide1').css('display', 'block');
                });
                $('.sh1').mouseout(function(event) {
                    $('.showhide1').css('display', 'none');
                });
                $('.sh2').mouseover(function(event) {
                    $('.showhide2').css('display', 'block');
                });
                $('.sh2').mouseout(function(event) {
                    $('.showhide2').css('display', 'none');
                });
                $('.sh3').mouseover(function(event) {
                    $('.showhide3').css('display', 'block');
                });
                $('.sh3').mouseout(function(event) {
                    $('.showhide3').css('display', 'none');
                });
                $('.sh4').mouseover(function(event) {
                    $('.showhide4').css('display', 'block');
                });
                $('.sh4').mouseout(function(event) {
                    $('.showhide4').css('display', 'none');
                });
                
            })
        </script> 
        <script>
		  	function selectCheck(){
	    	   var judge = $("#selectCheck").val();
	    	   var objs = document.getElementsByName("items");
			   if(judge == 1){
				   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = true;
		    	   }
				   $("#selectCheck").val(0);
	    	   }else{
	    		   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = false;
		    	   }
	    		   $("#selectCheck").val(1);
	    	   }
	    	   
	    	   checkedShow();
	       }
		  	
		  	function checkedShow(){
		  		var str = "";
	    	    var number = 0;
	    	    var obj = document.getElementsByName("items");
				for(var i = 0,l = obj.length;i < l;i++){
					if(obj[i].checked){
						str += obj[i].value+",";
						number++;
					}
				}    	   
	    			
	    	    if(str == ""){
	    		   $(".yezi1").hide();
	    		   
	    		   $('.smalltitle p').css('display', 'block');
	    		   $('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
	    	    }else{
	    	       //$('.smalltitle p').css('display', 'none');
	    		   $(".client_id").html(str);
	    		   $(".yezi1").show();
	    		   $("#number").html(number);
	    		   
	    		   $('.light3').css('display', 'none');
	    		   $('.yezi3').css('display', 'none');
	    		   $('.checkok').css('display', 'block');
	    		   $('.del').css('display', 'block');
	    		   $('.shift').css('display', 'block');
	    		   $('.close2').css('display', 'block');
	    		   
	    		   $('.yezi1 .shanchu').css('display', 'block');
	    		   $('.yezi1 .bianji1').css('display', 'block');
	    		  
	    	   }
	    	    $("table").find(".tline2").each(function(){
					 if($(this).find("td[class=xuanze]").find("input[class=check1]").is(":checked")){	
						/* $(this).find("input[class=vals]").css("display","none");
						var zhuizong=$(this).find("input[class=zhuizong]").val();
						$(this).find("select[class=sels]").css("display","inline");
						var options1 = $(this).find("select[class=sels] > option");
						//options是集合，数组的意思,i指索引,option指当前的对象
						 $.each(options1,function(i,option){
							if(option.text ==zhuizong )
							{
								option.selected= true;
							}
						}); */ 	
					 }else{
						 $(this).find("input[class=vals]").show();
						 $(this).find("select[class=sels]").hide();
					 }
	    	    });
		  	}
		  	$(function(){
		  		$('.close2').click(function(event) {
		  			$(".yezi1").hide();
		  			$(".yezi").show();
		  			$('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
		  		});
		  	})
		  	 
		  </script>
    </head>
    <body>
    	<div class="bigbox">
    		<nav class="daohan">
                <ul>
                	<li class="sh1">
                        <a href="<%=basePath %>notice/findByAll.action"><p class="mline"><span class="smallicon" id="current1"></span><span class="navtxt">首页</span></p></a>  
                    </li>
                    <li>
                        <a href="<%=basePath %>client/qiangenzongcount.action?zhuizong=0"  ><p class="mline"><span class="smallicon" id="current11"></span><span class="navtxt"  >用户开发</span></p></a>
                    </li>
                    <li>
                        <a href="<%=basePath %>client/selectDepOrSta.action?start=1" id="sline">
                            <p class="mline">
                                <span class="smallicon" id="ziji21"></span>
                                <span class="navtxt" id="current2">代理开发</span>
                            </p>
                        </a>
                    </li>
                     <li>
                        <a href="<%=basePath %>approve/count.action?pageSize=0"><p class="mline"><span class="smallicon one2"></span><span class="navtxt">合同审批</span></p></a> 
                    </li>
                    <li>
                         <a href="<%=basePath%>page/pacts.jsp">
                             <p class="mline"><span class="smallicon one222"></span><span class="navtxt">审批详情</span></p>
                         </a>
                        
                    </li>
                    
                     <li>
                        <a href="<%=basePath %>Operate/count.action">
                             <p class="mline"><span class="smallicon" id="yunyin2"></span><span class="navtxt">运营管理</span></p>
                         </a>
                    </li>  
                    
                   <li>
                        <a href="#"><p class="mline"><span class="smallicon one3"></span><span class="navtxt">产品资源库</span></p></a>
                    </li>
                    <c:if test="${backstage == 1}">
                    	<li>
	                        <a href="<%=basePath %>client/findByAllGr.action"><p class="mline"><span class="smallicon one333"></span><span class="navtxt">后台管理</span></p></a>
	                    </li>
                    </c:if>
                </ul>
            </nav>
            
    		<div class="showbox">
                <h2>代 理 开 发
                	<span class="exit">
						<span class="ex1">姓名:${staff.staff_name}</span>
						<a href="../login/tuichustaff.action" class="ex2"><span class="exicon2"></span>切换账号</a>
						<a href="../login/tuichustaff.action" class="ex3"><span class="exicon3"></span>退出账号</a>
					</span>
                </h2>
                <div class="showbox2">
	    			<div style="width:98%;margin:50px auto 0px;">
                		<ol style="overflow:hidden;">
	                		<li><a href="<%=basePath %>client/selectDepOrSta.action?start=1" >正在追踪</a></li>
	                		<li style="background:#2a3845"><a href="<%=basePath %>client/selectDepOrSta.action?start=2" style="color:#fff;">已开发</a></li>
	                	</ol>
                	</div>
	    			<div class="aaa">
		    			<div class="smalltitle">
		 					
							<a href="#" class="light3"><span class="imgmove imgmove2"><img src="../images/newkh.png" alt=""></span>&nbsp;&nbsp;新建代理</a>
							<span class="yezi3">
		 						<form action="<%=basePath %>client/selectDepOrSta.action?start=2" method="post" onsubmit="selectBy()">
									<input value="${select}" type="text"  id="select" name="select" placeholder="&nbsp;&nbsp;&nbsp;&nbsp;请输入您要搜索的关键字" style="color:#bfbfbf;font-size:12px;border-radius: 16px;outline:none;border:1px solid #e7e7e8;height:36px;width:200px">
		 							<input type="submit"  value="搜 索" style="height:36px;width:70px;border-radius: 16px;outline:none;border:none;background:#1fd4fb;color:#fff;margin-left:10px;">
								</form>	
		 					</span>
		 					<p class="yezi">
								<!-- <a href="#"><span class="imgmove imgmove2"><img src="../images/daoru.png" alt=""></span>&nbsp;&nbsp;导入</a>
								<a href="#"><span class="imgmove"><img src="../images/daochu.png" alt=""></span>&nbsp;&nbsp;导出</a> -->
							 </p>
							 <span class="yezi1">
								 
								 <h4 class="checkok">已选择 <span style="color:#1fd4fb;" id="number"> </span> 项</h4>
								 <a href="#" class="bianji"  style="left:20%;display:none;" onclick="updateTo()"><span class="imgmove"><img src="../images/pass.png" alt="" ></span>&nbsp;&nbsp;确认</a>
								 <a href="#" class="bianji1" onclick="updatePage()"><span class="imgmove"><img src="../images/bianjihui (1).png" alt="" ></span>&nbsp;&nbsp;编辑</a>
				    				<span class="close2">
				    					<img src="../images/guanbi.png" alt="">
				    				</span>
			    			 </span> 
		    			</div>
	    				
	    				<table class="tab">
	    					<tr class="tline">
	    						<td class="xuanze"><input type="checkbox" class="check1" id="selectCheck" value="1" onclick="selectCheck()"></td>
	    						<td class="cname">编码</td>
			    		        <td style="padding:0px 5px;">公司名称</td>
			    		        <td style="padding:0px 5px;">公司负责人</td>
			    		        <td style="padding:0px 5px;">电话</td>
			    		        <td style="padding:0px 5px;">联系QQ</td>
			    		        <td style="padding:0px 5px;">来源渠道</td>
			    		        <td style="padding:0px 5px;">追踪情况</td>
	    					</tr>
	    					
	    					<c:forEach items="${clients}" var="client" varStatus="index">
		    					<c:choose>
		    					 		<c:when test="${index.index % 2 == 0 }">
		    						<tr class="tline tline2" style="background:#fff;">
			    						<td class="xuanze" style="background:#fff;">
			    							<input type="checkbox" class="check1" value="${client.client_id}" name="items" onclick="checkedShow()">
			    						</td>
				    		            <td class="cname" ><a style="text-decoration:none;color:#8c8c8d;font-size:14px;" href="../client/newrecord.action?id=${client.client_id}">${client.client_id}</a></td>
				    		            <td style="padding:0px 5px;">${client.company_name}</td>
				    		            <td style="padding:0px 5px;">${client.company_fuzeren}</td>
		    		            		<td style="padding:0px 5px;">${client.client_phone}</td>
				    		            <td style="padding:0px 5px;">${client.client_qq}</td>
				    		            <td style="padding:0px 5px;">${client.client_record}</td>
				    		            <td style="padding:0px 5px;">
					    		            <input type="text" class="vals" value="${client.client_remarks}" style="text-align:center;border:none;background:none;" disabled="disabled">
					    		            <select style="display:none;" class="sels">
					    		            	<option value="正在跟踪">正在跟踪</option>
					    		            	<option value="已开发">已开发</option>
					    		            </select>
				    		            </td>
			    					</tr>
			    					</c:when>
	    					 		<c:otherwise>
	    					 			<tr class="tline tline2">
				    						<td class="xuanze">
				    							<input type="checkbox" class="check1" value="${client.client_id}" name="items" onclick="checkedShow()">
				    						</td>
					    		            <td class="cname" ><a style="text-decoration:none;color:#8c8c8d;font-size:14px;" href="../client/newrecord.action?id=${client.client_id}">${client.client_id}</a></td>
					    		           <td style="padding:0px 5px;">${client.company_name}</td>
				    		             <td style="padding:0px 5px;">${client.company_fuzeren}</td>
		    		            		<td style="padding:0px 5px;">${client.client_phone}</td>
				    		            <td style="padding:0px 5px;">${client.client_qq}</td>
				    		            <td style="padding:0px 5px;">${client.client_record}</td>
				    		            <td style="padding:0px 5px;">
					    		            <input type="text" class="vals" value="${client.client_remarks}" style="text-align:center;border:none;background:none;" disabled="disabled">
					    		            <select style="display:none;" class="sels">
					    		            	<option value="正在跟踪">正在跟踪</option>
					    		            	<option value="已开发">已开发</option>
					    		            </select>
				    		            </td>
	    					 		</c:otherwise>
    					 		</c:choose>
	    					</c:forEach>
	    				</table>
	    				<div id="pageaaa" style="text-align:right;margin-top:100px;width:98%;"></div>
	    				<div id="cover4">
				<div id="cover-bg3"></div>
				<div id="cover-content3" style="height:510px;margin-top:-310px;">
					<h4>新 建 代 理<span class="close"></span></h4>
							<p class="main">
							<input type="hidden" id="staffid" placeholder="&nbsp;&nbsp;请输入公司名称 " class="shurukuang" value="${staff.staff_id}">
								<span class="leftmain" >公 司 名 称</span>
								
								<input type="text" id="client_name" placeholder="&nbsp;&nbsp;请输入公司名称 " class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain" >公司负责人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" style="margin-left:0px;" id="client_fuzeren" placeholder="&nbsp;&nbsp;请输入负责人名字 " class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain" >电 话&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" id="client_phone" placeholder="&nbsp;&nbsp;请输入电话 " class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain" >联 系 Q Q</span>
								<input type="text" id="client_qq" placeholder="&nbsp;&nbsp;请输入联系QQ" class="shurukuang">
							</p>
							<p class="main" style="display: none">
								<span class="leftmain">客 户 级 别</span>
								<select id="client_jibie" class="shenfenselect shenfenselect3">
									<option value="">&nbsp;请选择客户级别</option>
									<c:forEach items="${ranks}" var="rank">
										<option value="${rank.rankName}">${rank.rankName}</option>
									</c:forEach>
								</select>
							</p>
							<p class="main" >
								<span class="leftmain">来 源 渠 道</span>
								<select id="client_qudao" class="shenfenselect shenfenselect3">
									<option value="">&nbsp;请选择来源渠道</option>
									<c:forEach items="${records}" var="record">
										<option value="${record.recordName}">${record.recordName}</option>
									</c:forEach>
								</select>
							</p>
							<p class="main" style="text-align:center;">
								<button class="btn1 btn2" onclick="saveClient()">保存</button>
								<button class="btn1 btn3">取消</button>
							</p>
							
						</div>
					 </div>
	    		</div>
	    	</div>
            </div>
            <div style="display: none">
	        	<span class="pageCount">${pageCount}</span>
	        	<span class="pageNum">${pageNum}</span>
	    	</div>
	    	<div style="display: none">
	    		<span class="client_id"></span>
	    	</div>
	    	
	    	<div class="bianjis">
	    		<p>信息修改<img src="../images/guanbi.png" alt="" class="gb"></p>
	    		<form action="javascript:updateguanli()" method="post" onsubmit="return textas()">
	    			<input type="hidden" disabled="disabled" id="staffId" value="${staff.staff_id}">
	    			<p><span style="margin-right:43px;">姓 名</span><input type="text" disabled="disabled" id="xingming" value="${staff.staff_name}"></p>
	    			<p><span style="margin-right:28px;">手 机 号</span><input type="text" id="shoujihao" value="${staff.staff_phone}"><span>*</span></p>
	    			<p><span style="margin-right:28px;">旧 密 码</span><input type="hidden" id="mimajiu" value="${staff.staff_password}"><input type="text" name="password" id="mimatian" value=""><span>*</span></p>
	    			<p><span style="margin-right:28px;">新 密 码</span><input type="password" name="password" class="newpass" id="mima" value=""><span>*</span></p>
	    			<p><span style="margin-right:10px;">确 认密 码</span><input type="password" name="password" class="newspass" id="" value=""><span>*</span></p>
	    			<p><span style="margin-right:19px;">邮 箱 号</span><input type="text" id="youxiang" value="${staff.staff_email}"><span>*</span></p>
	    			<p><input type="button" value="取消" class="qi"><input type="submit" value="确定"></p>
	    		</form>
	    	</div>
    		<div class="smallsa"></div>
	    	<div id="cover-content2" style="display:none;top:232px;height:510px;">
					<h4>编 辑 客 户<span class="close"></span></h4>
					<p class="main">
					<input type="hidden" id="kehuid"  class="shurukuang" value="">
							<input type="hidden" id="staffid" placeholder="&nbsp;&nbsp;请输入公司名称 " class="shurukuang" value="${staff.staff_id}">
								<span class="leftmain" >公 司 名 称</span>
								
								<input type="text" id="upcompany_name" placeholder="&nbsp;&nbsp;请输入公司名称 " class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain" >公司负责人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" style="margin-left:0px;" id="upcompany_fuzeren" placeholder="&nbsp;&nbsp;请输入负责人名字 " class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain" >电 话&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" id="upclient_phone" placeholder="&nbsp;&nbsp;请输入电话 " class="shurukuang">
							<p class="main">
								<span class="leftmain" >联 系 Q Q</span>
								<input type="text" id="upclient_qq" placeholder="&nbsp;&nbsp;请输入联系QQ" class="shurukuang">
							</p>
							<p class="main">
								<span class="leftmain">分配的员工</span>
								<select id="" class="shenfenselect shenfenselect3">
									<option value="">张三</option>
									<option value="">李四</option>
								</select>
							</p>
							<p class="main" style="display: none">
								<span class="leftmain">客 户 级 别</span>
								<select id="upclient_jibie" class="shenfenselect shenfenselect3">
									<option value="">&nbsp;请选择客户级别</option>
									<c:forEach items="${ranks}" var="rank">
										<option value="${rank.rankName}">${rank.rankName}</option>
									</c:forEach>
								</select>
							</p>
							<p class="main" >
								<span class="leftmain">来 源 渠 道</span>
								<select id="upclient_qudao" class="shenfenselect shenfenselect3">
									<option value="">&nbsp;请选择来源渠道</option>
									<c:forEach items="${records}" var="record">
										<option value="${record.recordName}">${record.recordName}</option>
									</c:forEach>
								</select>
							</p>
							<p class="main">
								<span class="leftmain" >追 踪 情 况</span>
								<select type="text" id="upclient_remarks" placeholder="&nbsp;&nbsp; " class="shurukuang">
									<option>正在跟踪</option>
									<option>已开发</option>
								</select>
							</p>
					<p class="main" style="text-align:center;">
						<button type="button" class="btn1 btn2" onclick="update()">保存</button>
						<button class="btn1 btn3">取消</button>
					</p>	
			</div>
			<div class="smallsa1"></div>
					
							
    </body>
    
    <script type="text/javascript">
    function saveClient(){
    	var numbers=/^[0-9]*$/;
    	var staffId=$("#staffid").val();
		var client_name = $("#client_name").val();
		if(client_name == ""){
			alert("客户名称不能为空");
			return;
		}
		var client_bianma=$("#client_bianma").val();
		var client_guishu=$("#client_guishu").val();
		var client_contractrate = $("#client_contractrate").val();
		
		var client_qq = $("#client_qq").val();
		var client_phone = $("#client_phone").val();
		var client_remarks = "已开发";
		if(client_phone == ""){
			alert("电话不能为空");
			return;
		}
		var client_jibie = $("#client_jibie option:selected").val();
		var client_qudao=$("#client_qudao").val();
		var client_fuzeren=$("#client_fuzeren").val();
		var pageNum = $(".pageNum").html();
		var start=1;
		$.ajax({
			type:"post",
			url:"../client/saveQian.action",
			data:"company_name="+client_name+"&client_phone="+client_phone+"&company_fuzeren="+client_fuzeren+"&client_remarks="+client_remarks+"&client_staffId="+staffId+"&start="+start+"&client_qq="+client_qq+"&client_contractrate="+client_contractrate+"&client_encode="+client_bianma+"&staff_name="+client_guishu+"&client_level="+client_jibie+"&client_record="+client_qudao,
			success:function(data){
				alert(data);
				if(data == "新增成功"){
					location.href= "../client/selectDepOrSta.action?pageNum="+pageNum+"&start="+start;
				}
			},
			error:function(e){
			}

   		 });
		}
    function updatePage(){
    	/* var che=$(".check1").attr("checked");
    	alert(che); */
    	$(".bianji").show();
    	$("table").find(".tline2").each(function(){
    		if($(this).find("td[class=xuanze]").find("input[class=check1]").is(":checked")){
				
				$(this).find("input[class=vals]").css("display","none");
				var shifoufukuan=$(this).find("input[class=vals]").val();
				
				$(this).find("select[class=sels]").css("display","inline");
				var options1 = $(this).find("select[class=sels] > option");
			 }else{
				 
			 }
		});
      	   
  		
  	}
    
    
    function update(){
		var client_id = $("#kehuid").val();
		var upcompany_name = $("#upcompany_name").val();
		var upcompany_fuzeren = $("#upcompany_fuzeren").val();
		var upclient_guishu = $("#upclient_guishu").val();
		var upclient_qq = $("#upclient_qq").val();
		var upclient_phone = $("#upclient_phone").val();
		var upclient_bianma = $("#upclient_bianma").val();
		var upclient_remarks = $("#upclient_remarks").val();
		var upclient_contractrate=$("#upclient_contractrate").val();
		var upclient_qudao= $("#upclient_qudao option:selected").val();;
		var pageNum = $(".pageNum").html();
		var start=1;
		$.ajax({
				type:"post",
				data:"client_id="+client_id+"&company_name="+upcompany_name+"&company_fuzeren="+upcompany_fuzeren+"&client_phone="+upclient_phone+"&client_qq="+upclient_qq+"&client_remarks="+upclient_remarks+"&staff_name="+upclient_guishu+"&client_encode="+upclient_bianma+"&client_contractrate="+upclient_contractrate+"&client_record="+upclient_qudao,
				url:"<%=basePath %>client/update.action",
				success:function(data){
					alert(data);
					location.href= "<%=basePath%>/client/selectDepOrSta.action?pageNum="+pageNum+"&start="+start;
				},
				error:function(e){
					alert("发生未知错误请刷新页面");
				}

   		 });
	}
   
    $(".close").click(function(){
    	$("#cover-content2").css("display","none");
    	$(".smallsa1").css("display","none");
    });
    function updateguanli(){
    	var url="${pageContext.request.contextPath}/staff/qianupdate.action";
		var pam={
				staff_id:$("#staffId").val(),
				staff_password:$("#mima").val(),
				staff_phone:$("#shoujihao").val(),
				staff_userName:$("#xingming").val(),
				staff_email:$("#youxiang").val()	
				};
		
		$.post(url,pam,function(data){		
				location="${pageContext.request.contextPath}/client/selectDepOrSta.action?start=1";
	});
    }
    
    $('.ex1').click(function(){
    	$('.bianjis').css('display','block');
    	$('.smallsa').css('display','block');
    })
    $('.gb').click(function(){
    	$('.bianjis').css('display','none');
    	$('.smallsa').css('display','none');
    })
     $('.qi').click(function(){
    	$('.bianjis').css('display','none');
    	$('.smallsa').css('display','none');
    })
    function textas(){
    	var shoujihao=$("#shoujihao").val();
    	var mima=$("#mimatian").val();
    	var mimajiu=$("#mimajiu").val();
    	var newpass=$(".newpass").val();
    	var newspass=$(".newspass").val();
    	var p=/\s/;
    	if(shoujihao==""||p.test(shoujihao)){
    		alert("请填写手机号！");
    		return false;
    	}else if(mima!=mimajiu){
    		alert("输入的密码不一致！");
    		return false;
    	}else if(newpass==mima){
    		alert("输入的密码不能与旧密码一致！");
    		return false;
    	}else if(newpass==""||p.test(newpass)){
    		alert("请输入新密码！");
    		return false;
    	}else if(newspass==""||p.test(newspass)){
    		alert("请再次输入新密码！");
    		return false;
    	}else if(newspass!=newpass){
    		alert("与重新设置的密码不相同，请重新输入！");
    		return false;
    	}
    	return true;
    } 
    
	   
	function updateTo(){
	    	
	    	var client_id = $(".client_id").html();
			client_id = client_id.substring(0,client_id.length-1);
			var clients = client_id.split(",");
			if(clients.length>1){
				alert("只能编辑一条客户记录");
				return false;
			}
			var sels = $(".sels option:selected").val();
			$.ajax({
 				type:"post",
 				data:"client_id="+client_id+"&client_remarks="+sels,
 				url:"<%=basePath %>client/update.action",
 				success:function(data){
 					location.href= "<%=basePath%>/client/selectDepOrSta.action?start=2";
 				},
 				error:function(e){
 					alert("发生未知错误请刷新页面");
 				}

	   		 }); 
    	}
    </script>
    <script src="../client/js/paging11.js"></script>
    <script>
         $(function(){  
        	 
        	 	var pageCount = $(".pageCount").html();
		    	var pageNum = $(".pageNum").html();
		    	pageNum = parseInt(pageNum);
		    	pageCount = parseInt(pageCount);
		        $('#pageaaa').paging({pageNo:pageNum,totalPage:pageCount,callback:function(cur){
		            console.log(cur);
		        }});
        	 
        	  //判断浏览器是否支持placeholder属性
        	  supportPlaceholder='placeholder'in document.createElement('input'),
        	 
        	  placeholder=function(input){
        	 
        	    var text = input.attr('placeholder'),
        	    defaultValue = input.defaultValue;
        	 
        	    if(!defaultValue){
        	 
        	      input.val(text).addClass("phcolor");
        	    }
        	 
        	    input.focus(function(){
        	 
        	      if(input.val() == text){
        	   
        	        $(this).val("");
        	      }
        	    });
        	 
        	  
        	    input.blur(function(){
        	 
        	      if(input.val() == ""){
        	       
        	        $(this).val(text).addClass("phcolor");
        	      }
        	    });
        	 
        	    //输入的字符不为灰色
        	    input.keydown(function(){
        	  
        	      $(this).removeClass("phcolor");
        	    });
        	  };
        	 
        	  //当浏览器不支持placeholder属性时，调用placeholder函数
        	  if(!supportPlaceholder){
        	 
        	    $('input').each(function(){
        	 
        	      text = $(this).attr("placeholder");
        	 
        	      if($(this).attr("type") == "text"){
        	 
        	        placeholder($(this));
        	      }
        	    });
        	  }
        	 
        	});
         </script>
</html>
